﻿using RestSharp;
using System;
using System.Web;
using Ymatou.ServiceCenter;
using YmtAuth.AppService;
using YmtAuth.Common.Extend;
using YmtAuth.Domain.Shard;
using YmtAuth.Dto;
using YmtSystem.CrossCutting;
using ResetService = ServiceStack.Service;

namespace YmtAuth.Web.Handlerv2
{
    
    public class IpAreaAuthHandler : ResetService
    {
        private IAuthAppService AuthAppService { get { return LocalServiceLocator.GetService<IAuthAppService>(); } }

        [ServiceRegister("/json/reply/IpAreaAuthStatusRequestDto", Method.POST)]
        public object Post(IpAreaAuthStatusRequestDto request)
        {
            request.RequestId = Guid.NewGuid().ToString("N");
            HttpContext.Current.Request.Headers.Add(YmtUserKey.RequestId, request.RequestId);
            HttpContext.Current.Request.Headers.Add(YmtAuthSafeConstant.ApiId, YmtAuthSafeConstant.Api_ipareaauth);

            return Action_Extend.ActionWatch(() => AuthAppService.AuthIpArea(request, Request), "[IpAreaAuth]Rid:" + request.RequestId);
        }
    }
}